import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/14 19:46
 * @description
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextLine()) {
            String t = sc.nextLine();
            Map<Character, Integer> map = new HashMap<>();
            Set<Character> ans = new HashSet<>();
            for (char c : t.toCharArray()) {
                ans.add(c);
                map.put(c, map.getOrDefault(c, 0) + 1);
            }
            List<Character> list = new ArrayList<>(ans);
            Collections.sort(list, (a, b)-> {
               if (!Objects.equals(map.get(a), map.get(b))) {
                   return map.get(b) - map.get(a);
               }
               return (char) (a - b);
            });
            for (Character a: list) {
                System.out.print(a);
            }
        }
        sc.close();
    }
}
